﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using Rung.Net.Events;

namespace Rung.Net.Base
{
    public interface INetBaseServer<T> : IDisposable
    {
        bool IsOnline { get; }
        ClientItemCollection<T> Clients { get; }

        event NetStoppedEventHandler OnStopped;
        event NetStartedEventHandler OnStarted;
        event NetClientReceivedEventHandler<T> OnReceived;
        event NetClientRejectedEventHandler OnClientRejected;
        event NetClientDisconnectedEventHandler OnClientDisconnected;
        event NetClientConnectedEventHandler OnClientConnected;
        event NetClientAcceptedEventHandler OnClientAccepted;


        void Start(int port);
        void Start(int port, int maxClients);
        void Start(IPAddress address, int port);
        void Start(IPAddress address, int port, int maxClients);
        void Stop();

        void DispatchAll(T data);
        void DispatchTo(Guid guid, T data);
        void DispatchTo(Guid[] guid, T data);
        void DispatchAllExcept(Guid guid, T data);

        void DisconnectClient(Guid guid);
        void DisconnectAll();
    }
}
